package com.whw.springboot.bcucb.controller;

import com.whw.springboot.bcucb.entity.Message;
import com.whw.springboot.bcucb.entity.Star;
import com.whw.springboot.bcucb.service.StarService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "点赞记录")
@RestController
@RequestMapping("/api/Star")
public class StarController {
    @Resource
    private StarService starService;

    /**
     * 增加点赞记录
     */
    @ApiOperation(value = "增加点赞记录")
    @PostMapping(value = "/")
    public Message<?> insertCaselevel(Star star){
        return starService.insertSelective(star);
    }

    /**
     * 删除点赞记录
     */
    @ApiOperation(value = "删除点赞记录")
    @DeleteMapping(value = "/")
    public Message<?> deleteByCaselevelId(int starId){
        return starService.deleteByPrimaryKey(starId);
    }

    /**
     * 修改点赞记录
     */
    @ApiOperation(value = "修改点赞记录")
    @PutMapping(value = "/")
    public Message<?> updateByCaselevelId(Star star){
        return starService.updateByPrimaryKeySelective(star);
    }

    /**
     * 查看某一个点赞记录
     */
    @ApiOperation(value = "查看某一个点赞记录")
    @GetMapping(value = "/one")
    public Message<Star> selectByCaselevelId(int starId){
        return starService.selectByPrimaryKey(starId);
    }

    /**
     * 查看所有个点赞记录
     */
    @ApiOperation(value = "查看所有个点赞记录")
    @GetMapping(value = "/all")
    public Message<List<Star>> selectByCaselevelId(){
        return starService.selectAll();
    }
}
